import { apiFindRegionList } from '@/api/region/api'

/**
 * 所有区域列表
 */


const state = {
  AllRegionList: []
}

const mutations = {
  CHANGE_SETTING: (state, { key, value }) => {
    if (state.hasOwnProperty(key)) {
      state[key] = value
    }
  }
}
const actions = {
  async setAllRegionList({ commit }) {
    const allRegionList = await apiFindRegionList()
    commit('CHANGE_SETTING', { key: 'AllRegionList', value: allRegionList })
  }
}

export default {
  namespaced: true,
  state,
  actions,
  mutations
}
